//  原版权信息 LAC v3 

//  修改者:
//  Copyright (c) 2025 刘子瑶
//  所属单位: 中国科学院信息工程研究所网络空间安全防御重点实验室
//           Key Laboratory of Cyberspace Security Defense, Institute of Information Engineering, CAS
//           中国科学院大学网络空间安全学院
//           School of Cyber Security, University of Chinese Academy of Sciences     

//  改动: 增加polar_enc_cpucycles、polar_dec_cpucycles的函数定义

#ifndef api_h
#define api_h

#include  "polarlac_param.h"
//  Set these three values apropriately for your algorithm
#define CRYPTO_SECRETKEYBYTES SK_LEN+PK_LEN
#define CRYPTO_PUBLICKEYBYTES PK_LEN
#define CRYPTO_BYTES MESSAGE_LEN
#define CRYPTO_SESSION HASHLEN
#define CRYPTO_CIPHERTEXTBYTES CIPHER_LEN

#define CRYPTO_SEEDBYTES SEED_LEN

// Change the algorithm name
#define CRYPTO_ALGNAME STRENGTH
//functions for pke
int crypto_encrypt_keypair( unsigned char *pk, unsigned char *sk);
int crypto_encrypt( unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *pk, unsigned char *seeds);
int crypto_encrypt_open(unsigned char *m, unsigned long long *mlen,const unsigned char *c, unsigned long long clen,const unsigned char *sk);
//key generation
int kg(unsigned char *pk, unsigned char *sk);
//key generation with seed
int kg_seed(unsigned char *pk, unsigned char *sk, unsigned char *seed);
// encryption
int original_pke_enc(const unsigned char *pk, const unsigned char *m, unsigned long long mlen, unsigned char *c, unsigned long long *clen, unsigned char *seeds);
// encryption with seed
int pke_enc_seed(const unsigned char *pk, const unsigned char *m, unsigned long long mlen, unsigned char *c, unsigned long long *clen, unsigned char *seeds);
int original_pke_enc_seed(const unsigned char *pk, const unsigned char *m, unsigned long long mlen, unsigned char *c, unsigned long long *clen, unsigned char *seed);
// print the average cpucycles of polar_enc
int polar_enc_cpucycles();
// decrypt
int original_pke_dec(const unsigned char *sk, const unsigned char *c, unsigned long long clen, unsigned char *m, unsigned long long *mlen);
// print the average cpucycles of polar_dec
int polar_dec_cpucycles();

//functions for kem
int crypto_kem_keypair( unsigned char *pk, unsigned char *sk);
int crypto_kem_enc( unsigned char *ct, unsigned char *ss, const unsigned char *pk);
int crypto_kem_dec( unsigned char *ss, const unsigned char *ct, const unsigned char *sk);

int kem_enc_fo(const unsigned char *pk, unsigned char *k, unsigned char *c);
// fo encryption for cca security with seed
int kem_enc_fo_seed(const unsigned char *pk, unsigned char *k, unsigned char *c, unsigned char *seed);
// decrypt of fo mode
int kem_dec_fo(const unsigned char *pk, const unsigned char *sk, const  unsigned char *c, unsigned char *k);

#endif /* api_h */
